package com.hsb.dao;

import com.hsb.entity.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserDao {
    //增加一条记录
    @Insert("insert into user(user_name,user_pwd,user_email) values(#{userName},#{userPwd},#{userEmail})")
    int insert(User user);

    //根据id删除记录
    @Delete("delete from user where user_id=#{id}")
    int deleteById(int id);

    //根据id查询记录
    @Select("select * from user where user_id=#{id}")
    User queryById(int id);

    //查询所有记录
    @Select("select * from user")
    List<User> queryAll();

    //根据id修改记录
    @Update("update user set user_name=#{userName},user_pwd=#{userPwd},user_email=#{userEmail} where user_id=#{userId}")
    int updateById(User user);
}
